import request from "@/util/request";
import type {NotificationTemplates} from "@/api/front/notification/type";
enum API{
    TEMPLATE_PAGE = "/front/notification/template/page",
    TEMPLATE= "/front/notification/template",
    NOTIFICATION= "/front/notification",
    NOTIFICATION_PAGE= "/front/notification/page",
}

/**
 * 获取通知模板列表
 * @param params 查询条件
 */
export function reqGetTemplatePage(params) {
    return request({
        url: API.TEMPLATE_PAGE,
        method: "get",
        params,
    });
}

export function reqCreateTemplate(data:NotificationTemplates) {
    return request({
        url: API.TEMPLATE,
        method: "post",
        data,
    });
}

export function reqUpdateTemplate(data:NotificationTemplates) {
    return request({
        url: API.TEMPLATE,
        method: "put",
        data,
    });
}
export function reqDeleteTemplate(id: number | string) {
    return request({
        url: API.TEMPLATE,
        method: "delete",
        params: {
            id,
        },
    });
}
export function reqCreateNotification(data:any) {
    return request({
        url: API.NOTIFICATION,
        method: "post",
        data,
    });
}
export function reqUpdateNotification(data:any) {
    return request({
        url: API.NOTIFICATION,
        method: "put",
        data,
    });
}
export function reqDeleteNotification(id: number | string) {
    return request({
        url: API.NOTIFICATION+"/"+id,
        method: "delete",
    });
}
export function reqGetNotificationPage(params) {
    return request({
        url: API.NOTIFICATION_PAGE,
        method: "get",
        params,
    });
}
export function reqGetNotification(id: number | string) {
    return request({
        url: API.NOTIFICATION+"/"+id,
        method: "get",
    });
}
